//
//  DiscoverDetailsCell.m
//  Coco_Music
//
//  Created by 强哥 on 15/6/23.
//  Copyright (c) 2015年 寇广超. All rights reserved.
//

#import "DiscoverDetailsCell.h"
#import "UIImageView+WebCache.h"

@implementation DiscoverDetailsCell

-(void)dealloc
{
    [self.HeadImage release];
    [self.songName release];
    [self.singerName release];
    [self.discover release];
    [super dealloc];
}


-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creation];
    }
    
    return self;
    
}

-(void)creation
{
    self.HeadImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"DAwKgDtlOHPZHgdJEEAAdi-BWrYJI010_mobile_large"]];
    self.HeadImage.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
    self.HeadImage.layer.cornerRadius = 10;
    self.HeadImage.layer.masksToBounds = YES;
    
    self.songName = [[UILabel alloc]initWithFrame:CGRectMake(0, self.frame.size.height, self.frame.size.width, 40)];
    
    
    self.singerName = [[UILabel alloc]initWithFrame:CGRectMake(0, self.frame.size.height+30, self.frame.size.width, 30)];
    self.singerName.textColor = [UIColor lightGrayColor];
    
    [self.contentView addSubview:_HeadImage];
    [self.contentView addSubview:_singerName];
    [self.contentView addSubview:_songName];
    [self.HeadImage release];
    [self.singerName release];
    [self.songName release];
    
}

-(void)setDiscover:(Discover *)discover
{
    if (_discover != discover) {
        [_discover release];
        _discover = [discover retain];
    }
    NSURL *url = [NSURL URLWithString:discover.SecondCellPic_url];
    [self.HeadImage sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"cm2_default_artist_banner-1"]];
     NSArray *array = [discover.SecondCellTitle componentsSeparatedByString:@" - "];
    self.songName.text = [array objectAtIndex:1];
    self.singerName.text = [array objectAtIndex:0];
}




@end
